<?php
namespace app\adminmall\controller;
use app\common\controller\AdminBaseController;
use think\Db;

/**
 * 访问购买率
 */
class VisitController extends AdminBaseController {
	private $number;
	public function index($p='1'){
		$map = [];
		if(request()->isPost()){
		 	$param = input('post.');
			//用户名称
			if($param['name']){
				$map['name'] = ['like', '%'.$param['name'].'%'];
			}
		}
		if($p=='1'){
			$list=Db::name('mall_goods_discount')
			->field('name,click,sales,round(sales/click ,2)*100 P')->where($map)
			->order('P DESC')->select();	
			}
			
		if($p=='2'){
			$list=Db::name('mall_goods_grab')
			->field('name,click,sales,round(sales/click ,2)*100 P')->where($map)
			->order('P DESC')->select();	
				}
		if($p=='3'){
			$list=Db::name('mall_goods_pintuan')
			->field('name,click,sales,round(sales/click ,2)*100 P')->where($map)
			->order('P DESC')->select();	
				}
		if($p=='4'){
			$list=Db::name('mall_goods_score')
			->field('name,click,sales,round(sales/click ,2)*100 P')->where($map)
			->order('P DESC')->select();	
				}	
		 return $this->fetch('index',['list'=>$list,'p'=>$p]);
		
	}

}
?>